package com.suineg.pms.service.base;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.google.common.collect.Lists;
import com.suineg.pms.entity.base.Community;
import com.suineg.pms.repository.base.CommunityDao;

/**
 *
 *@author Suine
 */
@Service
@Transactional(readOnly =true)
public class CommunityService {
	/** 日志输出对象 */
	protected final Logger logger = LoggerFactory.getLogger(getClass());
	
	@Autowired
	private CommunityDao communityDao;
	
	public Community get(Long id){
		return communityDao.findOne(id);
	}
	
	public Community findByName(String name){
		return communityDao.findByName(name);
	}
	
	public void save(Community community){
		communityDao.save(community);
	}
	
	public void delete(Long id){
		communityDao.delete(id);
	}
	
	public List<Community> findAll(){
		return Lists.newArrayList(communityDao.findAll());
	}

}

